#include <iostream>
#include "memento.h"

Originator::~Originator()
{
    delete mt_;
}

Mementor *Originator::CreateMementor()
{
    Mementor *m = new Mementor();
    SaveMemento(m);
    return m;
}

void Originator::SaveMemento(Mementor *mem)
{
    mem->SetState(state_);
}

void Originator::RestoreMemento(Mementor *mem)
{
    state_ = mem->GetState();
}

std::string Originator::GetState()
{
    return state_;
}

void Originator::SetState(const std::string & state)
{
    state_ = state;
}

void Originator::PrintInfo()
{
    std::cout << "state:" << state_ << std::endl;
}

void Mementor::SetState(const std::string state)
{
    state_ = state;
}

std::string Mementor::GetState()
{
    return state_;
}


